<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:template name="noLongWords">
 <xsl:param name="text"/>
 <xsl:param name="limit"/>
 <xsl:param name="cc"/>
 <xsl:choose>
   <xsl:when test="$cc &lt; 0">
   	...
	</xsl:when>
   <xsl:when test="string-length(substring-before($text,' ')) &gt; 0 and string-length(substring-before($text,' ')) &lt; $limit">
<xsl:value-of select="substring-before($text,' ')"/>&#32;<xsl:if test="string-length(substring-after($text,' ')) &gt; 0"><xsl:call-template name="noLongWords"><xsl:with-param name="text" select="substring-after($text,' ')"/><xsl:with-param name="limit" select="$limit"/><xsl:with-param name="cc" select="$cc - string-length(substring-before($text,' '))"/></xsl:call-template></xsl:if>
	</xsl:when>
   <xsl:when test="(string-length(substring-before($text,' ')) = 0)">
<xsl:value-of select="substring($text,1,$limit)"/>&#32;<xsl:if test="string-length(substring($text,$limit)) &gt; 0"><xsl:call-template name="noLongWords"><xsl:with-param name="text" select="substring($text,$limit)"/><xsl:with-param name="limit" select="$limit"/><xsl:with-param name="cc" select="$cc - string-length(substring($text,1,$limit))"/></xsl:call-template></xsl:if>
	</xsl:when>
   <xsl:when test="(string-length($text) &gt; $limit ) or string-length(substring-before($text,' ')) &gt; $limit">
<xsl:value-of select="substring($text,1,$limit)"/>&#32;<xsl:if test="string-length(substring($text,$limit )) &gt; 0"><xsl:call-template name="noLongWords"><xsl:with-param name="text" select="substring($text,$limit )"/><xsl:with-param name="limit" select="$limit"/><xsl:with-param name="cc" select="$cc - string-length(substring($text,1,$limit))"/></xsl:call-template></xsl:if>
	</xsl:when>
 </xsl:choose>
</xsl:template>

<xsl:template match="forum">
<table background="/imgs/serpente.gif" style="background-position:top right;background-repeat: no-repeat;" class="fbox" border="0" cellspacing="0" cellpadding="5" width="100%">
<tr>
<td align="center" class="fboxR">Messaggi del forum: <a class="body" style="text-decoration: none;" href="/forumShow.aspx?jumpToForum={@ID}&amp;forumStep=20"><xsl:value-of select="@title"/></a></td>
</tr>

<!--<tr><td background="imgs/dottedline.gif" style="BACKGROUND-REPEAT: repeat-x;" width="100%" align="center"></td></tr>-->
<xsl:for-each select="row[@public!=3 and position() &lt; 6]">
<tr class="body9">
<td class="fboxD">
<xsl:choose>
	<xsl:when test="@public=2">
		<b>Messaggio cancellato!</b>
	</xsl:when>
	<xsl:otherwise>
		<xsl:value-of select="@text" disable-output-escaping="yes"/>
	</xsl:otherwise>
</xsl:choose>
(<xsl:choose>
	<xsl:when test='@ngId'>
<font class="body9"><xsl:value-of select="@ngFrom"/></font>
	</xsl:when>
	<xsl:otherwise>

	<xsl:choose>
		<xsl:when test="(floor( @settings div 8192 ) mod 2) and (floor( @settings div 16384 ) mod 2)">
			<a style="color:#006699;" href="/userinfo/blog.aspx?userid={@userid}"><xsl:value-of select="@nick"/></a>
		</xsl:when>
		<xsl:when test="0=(floor( @settings div 8192 ) mod 2) or (floor( @settings div 16384 ) mod 2)">
			<a style="color:#006699;" href="/profileShow.aspx?userGuid={@userid}"><xsl:value-of select="@nick"/></a>
		</xsl:when>
		<xsl:otherwise>

		</xsl:otherwise>
	</xsl:choose>

	</xsl:otherwise>
</xsl:choose>)
</td>
</tr>
<!--<tr><td background="imgs/dottedline.gif" style="BACKGROUND-REPEAT: repeat-x;" width="100%" align="center"></td></tr>-->
</xsl:for-each>
<tr><td align="center" class="fboxR">

<table border="0" width="100%" cellpadding="0">
<tr>
<td align="left"><a class="body9" href="/forumShow.aspx?jumpToForum={@ID}&amp;forumStep=20">Partecipa al forum</a></td>

<td align="right">

<font class="body9">Ci sono <xsl:value-of select="@totalMsgs"/> messaggi nel forum</font>
</td>
</tr>
</table>

</td></tr>

</table>

</xsl:template>

</xsl:stylesheet>